# -*- coding: utf-8 -*
'''
    Created by XiaoInk at 2021/10/08 22:34:03
    Gitee: https://gitee.com/XiaoInk
'''

import os


class _Config(object):
    pass


class Prod(_Config):
    pass


class Test(_Config):
    pass


class Dev(_Config):
    pass


class Local(_Config):
    DOMAIN = f'http://{os.getenv("HOST", "127.0.0.1")}:{os.getenv("PORT", 5000)}'
    MYSQL_W = {
        'host': os.getenv('MYSQL_HOST', '127.0.0.1'),
        'port': os.getenv('MYSQL_PORT', 3306),
        'user': os.getenv('MYSQL_USER', 'root'),
        'password': os.getenv('MYSQL_PASSWORD', '123456'),
        'database': os.getenv('MYSQL_DATABASE', 'flaskdb')
    }
    MYSQL_R = MYSQL_W
    REDIS = {
        'host': os.getenv('REDIS_HOST', '127.0.0.1'),
        'port': os.getenv('REDIS_PORT', 6379),
        'password': os.getenv('REDIS_PASSWORD', '123456'),
        'db': os.getenv('REDIS_DB', 0)
    }


def get_config(env: str = 'local'):
    return {'prod': Prod, 'test': Test, 'dev': Dev, 'local': Local}.get(env)


if __name__ == '__main__':
    pass
